package com.ly.heart.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ly.heart.domain.KingProcureRefundMaterialEntity;
import com.ly.heart.domain.dto.KingInventoryMaterialQueryDto;
import com.ly.heart.domain.dto.KingOrderMaterialQueryDto;
import com.ly.heart.domain.dto.KingProcureRefundQueryDto;
import com.ly.heart.domain.dto.ReceiveNoticeMaterialQueryDto;
import com.ly.heart.domain.vo.KingProcureRefundVo;
import com.ly.heart.domain.vo.OrderSumResult;

/**
 * 金蝶-采购退料单物料明细Mapper接口
 *
 * @author cxl
 * @date 2024-07-16
 */
public interface KingProcureRefundMaterialMapper extends BaseMapper<KingProcureRefundMaterialEntity> {

    /**
     * 查询采购退料单列表，以物料为主
     * @param queryDto
     * @return
     */
    List<KingProcureRefundVo> getKingProcureRefundList(KingProcureRefundQueryDto queryDto);

    /**
     * 查询金蝶-采购退料单物料明细
     *
     * @param id 金蝶-采购退料单物料明细ID
     * @return 金蝶-采购退料单物料明细
     */
     KingProcureRefundMaterialEntity selectKingProcureRefundMaterialEntityById ( String id );

    /**
     * 查询金蝶-采购退料单物料明细列表
     *
     * @param kingProcureRefundMaterialEntity 金蝶-采购退料单物料明细
     * @return 金蝶-采购退料单物料明细集合
     */
     List<KingProcureRefundMaterialEntity> selectKingProcureRefundMaterialEntityList ( KingProcureRefundMaterialEntity kingProcureRefundMaterialEntity );


    /**
     * 查询退料物料明细表与退料基础表关联关系
     * @param kingProcureRefundMaterialEntity
     * @return
     */
    List<KingProcureRefundMaterialEntity> queryRelationList ( KingProcureRefundMaterialEntity kingProcureRefundMaterialEntity );

    /**
     * 新增金蝶-采购退料单物料明细
     *
     * @param kingProcureRefundMaterialEntity 金蝶-采购退料单物料明细
     * @return 结果
     */
     int insertKingProcureRefundMaterialEntity ( KingProcureRefundMaterialEntity kingProcureRefundMaterialEntity );

    /**
     * 修改金蝶-采购退料单物料明细
     *
     * @param kingProcureRefundMaterialEntity 金蝶-采购退料单物料明细
     * @return 结果
     */
     int updateKingProcureRefundMaterialEntity ( KingProcureRefundMaterialEntity kingProcureRefundMaterialEntity );

    /**
     * 删除金蝶-采购退料单物料明细
     *
     * @param id 金蝶-采购退料单物料明细ID
     * @return 结果
     */
     int deleteKingProcureRefundMaterialEntityById ( String id );

    /**
     * 批量删除金蝶-采购退料单物料明细
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
     int deleteKingProcureRefundMaterialEntityByIds ( String[] ids );

    /**
     * 根据采购订单id和物料id查询集合
     */
    List<KingProcureRefundMaterialEntity> selectMaterialByOrderIdAndMaterialId(KingOrderMaterialQueryDto queryDto);

    /**
     * 根据采购订单id和物料id查询物料总数
     */
    OrderSumResult getMaterialNumByOrderIdAndMaterialId(KingOrderMaterialQueryDto queryDto);

    /**
     * 根据采购订单id和物料id查询该物料退货补货的数量
     */
    List<KingProcureRefundMaterialEntity> selectMaterialByOrderIdAndMaterialIdAndType(KingOrderMaterialQueryDto queryDto);

    /**
     * 【采购订单调用】根据采购订单id和物料id查询该物料退货补货的数量
     * @param queryDto
     * @return
     */
    OrderSumResult getMaterialNumByOrderIdAndMaterialIdAndType(KingOrderMaterialQueryDto queryDto);

    /**
     * 【采购入库单调用】根据采购入库单id和物料明细id获取该物料的数量
     * @param queryDto
     * @return
     */
    String getMaterialNumByInventoryIdAndMaterialId(KingInventoryMaterialQueryDto queryDto);

    /**
     * 【采购入库单调用】根据采购入库单id和物料明细id获取该物料累计退货退款数量
     * @param queryDto
     * @return
     */
    String getMaterialReturnNumByInventoryIdAndMaterialId(KingInventoryMaterialQueryDto queryDto);

    /**
     * 【采购入库单调用】根据采购入库单id和物料明细id获取该物料累计退货补货价税合计
     * @param queryDto
     * @return
     */
    String getReturnReplenishTotalPriceTaxByInventoryIdAndMaterialId(KingInventoryMaterialQueryDto queryDto);

    /**
     * 根据收料通知单id和物料id查询退料单总数
     * @param queryDto
     * @return
     */
    String getReturnNumByReceiveNotice(ReceiveNoticeMaterialQueryDto queryDto);

}
